Setting a link attribute for multiple links

Hi,

I have a link module that has a LINK attribute that has an enumerated type “Delivery phase” with values “Del A”, “Del B”, “Del C".

Module A has “many to many” links to Module B objects via this link module.

As an example,

Module A object #1 has links to

Module B objects #1, #2 #3, #4, #5

Can you advise what is the most efficient way to “Set” the link module attribute “Delivery Phase” to a specific value e.g. "Del A" for the links to a number of objects in Module B ?

The only way I know how to do this at the moment is to do it manually and go to the object #1 properties in Module A and go through each link manually and set the value. But object #1 may have 50 links to Module B objects and so this is quite a painstaking task to do manually.

Any help would be greatly appreciated.

Regards
Ray
monde888 - Thu Sep 06 10:47:37 EDT 2012

Re: Setting a link attribute for multiple links
llandale - Thu Sep 06 16:20:36 EDT 2012

I think you are saying that the link-value can be determined by seeing which B object is the target of the link. That is, you could give instructions for setting the link value to some intern. And if so then you reasonably deduce you should be able to "tell" a DXL script to do it as well.

If you cannot tell some intern how to determine the Delivery phase you will not be able to tell the script.

Perhaps this outline will get you going:

string NameLinkAttr = "Delivery Phase"
for oA in entire mod do
{  if (isDeleted(oA)) then continue
   for lnk in oA ->"whatever" do
   {  if (this is some other link) then continue
      oB = target of the link
      if (oB is not a "B" object) then continue
 
      ValueActual = lnk.NameLinkAttr
      if (!null ValueActual)   then continue    // Do not change an existing value
                  // OK, now lets try to set an currently null link value:
      if     (some characterist(oB) indicates Delivery A) then ValueDesired = "Del A"
      elseif(some characterist(oB) indicates Delivery B) then ValueDesired = "Del B"
      elseif(some characterist(oB) indicates Delivery C) then ValueDesired = "Del C"
      else    ValueDesired = ""    // Cannot determine what we want
 
      if (!null ValueDesired) then lnk.NameLinkAttr = ValueDesired
   }   // end for A->B links
}  // end for objects in A


-Louie

Re: Setting a link attribute for multiple links
monde888 - Wed Sep 26 09:49:09 EDT 2012

llandale - Thu Sep 06 16:20:36 EDT 2012

I think you are saying that the link-value can be determined by seeing which B object is the target of the link. That is, you could give instructions for setting the link value to some intern. And if so then you reasonably deduce you should be able to "tell" a DXL script to do it as well.

If you cannot tell some intern how to determine the Delivery phase you will not be able to tell the script.

Perhaps this outline will get you going:

string NameLinkAttr = "Delivery Phase"
for oA in entire mod do
{  if (isDeleted(oA)) then continue
   for lnk in oA ->"whatever" do
   {  if (this is some other link) then continue
      oB = target of the link
      if (oB is not a "B" object) then continue
 
      ValueActual = lnk.NameLinkAttr
      if (!null ValueActual)   then continue    // Do not change an existing value
                  // OK, now lets try to set an currently null link value:
      if     (some characterist(oB) indicates Delivery A) then ValueDesired = "Del A"
      elseif(some characterist(oB) indicates Delivery B) then ValueDesired = "Del B"
      elseif(some characterist(oB) indicates Delivery C) then ValueDesired = "Del C"
      else    ValueDesired = ""    // Cannot determine what we want
 
      if (!null ValueDesired) then lnk.NameLinkAttr = ValueDesired
   }   // end for A->B links
}  // end for objects in A


-Louie

Hi Louie,

Just want to say a huge thanks for your help with my "remedial" questions :o)
Used your outline code and got it to do what I wanted.

Thanks again !!

Ray